<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>背景</title>
    <style>
      .box1{
           width: 300px;
           height: 300px;
           /* background-color: yellow; */
           /* background-color: rgb(255, 0,0); */
           /* background-color: rgb(255, 0,0); */
           /* rgba中的a是代表透明度 */
           background-color: #ff0000;
           
      }
      .box2{
          width: 100px;
          height: 100px;
          background-color: rgba(0, 0, 0,0.4);
      }
    </style>
</head>
<body>
    <div class="box1">
        大家好
        <div class="box2"></div>
    </div>
</body>
</html>